//随机数
export function randomNum(min, max) {
  return parseInt(Math.random() * (max - min + 1) + min);
};
//随机颜色
export function randomColor(min, max) {
  const r = randomNum(min, max);
  const g = randomNum(min, max);
  const b = randomNum(min, max);
  return `rgb(${r},${g},${b})`;
};

/**
* 黑白打印console
* @param {any} hint 提醒内容
* @param {any} content 打印内容
* @param {any} type 打印类型（log,trace,warn，error）
    colorLog("test", "111", "info");
    colorLog("test", "111", "error");
    colorLog("test", "111", "warn");
    colorLog("test", "111", "trace");
*/
export function colorLog(hint, content, type = "info") {
  const color = {
    info: "#52c41a",
    warn: "#faad14",
    error: "#f5222d",
    log: "#66ccff",
  };
  const hintContent = `%c${hint}`;
  const hintStyle = `
      vertical-align: middle;
      display: flex;
      height: 100%;
      line-height: 1.5;
      background: ${color[type]}; 
      color: white; 
      border-radius: 3px 0 0 3px; 
      font-size: 14px; 
      padding: 0 5px;
      box-sizing: border-box;
      background-clip: border-box;
    `;
  console[type](`${hintContent}`, `${hintStyle}`, content);
}